/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    'cn-hangzhou' = 'business.aliyuncs.com',
    'cn-shanghai' = 'business.aliyuncs.com',
    'ap-southeast-1' = 'business.ap-southeast-1.aliyuncs.com',
    'ap-northeast-1' = 'business.ap-southeast-1.aliyuncs.com',
    'ap-northeast-2' = 'business.ap-southeast-1.aliyuncs.com',
    'ap-northeast-2-pop' = 'business.ap-southeast-1.aliyuncs.com',
    'ap-south-1' = 'business.ap-southeast-1.aliyuncs.com',
    'ap-southeast-2' = 'business.ap-southeast-1.aliyuncs.com',
    'ap-southeast-3' = 'business.ap-southeast-1.aliyuncs.com',
    'ap-southeast-5' = 'business.ap-southeast-1.aliyuncs.com',
    'cn-beijing' = 'business.aliyuncs.com',
    'cn-beijing-finance-1' = 'business.aliyuncs.com',
    'cn-beijing-finance-pop' = 'business.aliyuncs.com',
    'cn-beijing-gov-1' = 'business.aliyuncs.com',
    'cn-beijing-nu16-b01' = 'business.aliyuncs.com',
    'cn-chengdu' = 'business.aliyuncs.com',
    'cn-edge-1' = 'business.aliyuncs.com',
    'cn-fujian' = 'business.aliyuncs.com',
    'cn-haidian-cm12-c01' = 'business.aliyuncs.com',
    'cn-hangzhou-bj-b01' = 'business.aliyuncs.com',
    'cn-hangzhou-finance' = 'business.aliyuncs.com',
    'cn-hangzhou-internal-prod-1' = 'business.aliyuncs.com',
    'cn-hangzhou-internal-test-1' = 'business.aliyuncs.com',
    'cn-hangzhou-internal-test-2' = 'business.aliyuncs.com',
    'cn-hangzhou-internal-test-3' = 'business.aliyuncs.com',
    'cn-hangzhou-test-306' = 'business.aliyuncs.com',
    'cn-hongkong' = 'business.aliyuncs.com',
    'cn-hongkong-finance-pop' = 'business.aliyuncs.com',
    'cn-huhehaote' = 'business.aliyuncs.com',
    'cn-huhehaote-nebula-1' = 'business.aliyuncs.com',
    'cn-north-2-gov-1' = 'business.aliyuncs.com',
    'cn-qingdao' = 'business.aliyuncs.com',
    'cn-qingdao-nebula' = 'business.aliyuncs.com',
    'cn-shanghai-et15-b01' = 'business.aliyuncs.com',
    'cn-shanghai-et2-b01' = 'business.aliyuncs.com',
    'cn-shanghai-finance-1' = 'business.aliyuncs.com',
    'cn-shanghai-inner' = 'business.aliyuncs.com',
    'cn-shanghai-internal-test-1' = 'business.aliyuncs.com',
    'cn-shenzhen' = 'business.aliyuncs.com',
    'cn-shenzhen-finance-1' = 'business.aliyuncs.com',
    'cn-shenzhen-inner' = 'business.aliyuncs.com',
    'cn-shenzhen-st4-d01' = 'business.aliyuncs.com',
    'cn-shenzhen-su18-b01' = 'business.aliyuncs.com',
    'cn-wuhan' = 'business.aliyuncs.com',
    'cn-wulanchabu' = 'business.aliyuncs.com',
    'cn-yushanfang' = 'business.aliyuncs.com',
    'cn-zhangbei' = 'business.aliyuncs.com',
    'cn-zhangbei-na61-b01' = 'business.aliyuncs.com',
    'cn-zhangjiakou' = 'business.aliyuncs.com',
    'cn-zhangjiakou-na62-a01' = 'business.aliyuncs.com',
    'cn-zhengzhou-nebula-1' = 'business.aliyuncs.com',
    'eu-central-1' = 'business.ap-southeast-1.aliyuncs.com',
    'eu-west-1' = 'business.ap-southeast-1.aliyuncs.com',
    'eu-west-1-oxs' = 'business.ap-southeast-1.aliyuncs.com',
    'me-east-1' = 'business.ap-southeast-1.aliyuncs.com',
    'rus-west-1-pop' = 'business.ap-southeast-1.aliyuncs.com',
    'us-east-1' = 'business.ap-southeast-1.aliyuncs.com',
    'us-west-1' = 'business.ap-southeast-1.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('bssopenapi', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model DataModuleMapListSpnTypeMapListValue = {
  filterModules?: [ 
    {
      moduleId?: long(name='ModuleId'),
      moduleCode?: string(name='ModuleCode'),
      moduleName?: string(name='ModuleName'),
    }
  ](name='FilterModules'),
  showModules?: [ 
    {
      moduleId?: long(name='ModuleId'),
      moduleCode?: string(name='ModuleCode'),
      moduleName?: string(name='ModuleName'),
    }
  ](name='ShowModules'),
}

model DataStepPriceMapValue = {
  rightClose?: boolean(name='RightClose'),
  min?: string(name='Min'),
  max?: string(name='Max'),
  currency?: string(name='Currency'),
  leftClose?: boolean(name='LeftClose'),
  stepPriceValue?: string(name='StepPriceValue'),
  priceValueType?: string(name='PriceValueType'),
  priceValue?: string(name='PriceValue'),
  deductCycleType?: string(name='DeductCycleType'),
}

model AddCouponDeductTagRequest {
  couponId?: string(name='CouponId'),
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.'),
    }
  ](name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  tags?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Tags'),
}

model AddCouponDeductTagShrinkRequest {
  couponId?: string(name='CouponId'),
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  tagsShrink?: string(name='Tags'),
}

model AddCouponDeductTagResponseBody = {
  data?: boolean(name='Data'),
  requestId?: string(name='RequestId'),
}

model AddCouponDeductTagResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddCouponDeductTagResponseBody(name='body'),
}

/**
 * @summary 添加优惠券抵扣标签
 *
 * @param tmpReq AddCouponDeductTagRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddCouponDeductTagResponse
 */
async function addCouponDeductTagWithOptions(tmpReq: AddCouponDeductTagRequest, runtime: Util.RuntimeOptions): AddCouponDeductTagResponse {
  Util.validateModel(tmpReq);
  var request = new AddCouponDeductTagShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  if (!Util.isUnset(tmpReq.tags)) {
    request.tagsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tags, 'Tags', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.couponId)) {
    query['CouponId'] = request.couponId;
  }
  if (!Util.isUnset(request.ecIdAccountIdsShrink)) {
    query['EcIdAccountIds'] = request.ecIdAccountIdsShrink;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  if (!Util.isUnset(request.tagsShrink)) {
    query['Tags'] = request.tagsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddCouponDeductTag',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 添加优惠券抵扣标签
 *
 * @param request AddCouponDeductTagRequest
 * @return AddCouponDeductTagResponse
 */
async function addCouponDeductTag(request: AddCouponDeductTagRequest): AddCouponDeductTagResponse {
  var runtime = new Util.RuntimeOptions{};
  return addCouponDeductTagWithOptions(request, runtime);
}

model CancelFundAccountLowAvailableAmountAlarmRequest {
  fundAccountId?: long(name='FundAccountId', example='123321123'),
}

model CancelFundAccountLowAvailableAmountAlarmResponseBody = {
  data?: boolean(name='Data', example='true'),
  metadata?: any(name='Metadata', example='{}'),
  requestId?: string(name='RequestId', example='DFC1F7F9-3BA9-BA4D-2F2E653'),
}

model CancelFundAccountLowAvailableAmountAlarmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelFundAccountLowAvailableAmountAlarmResponseBody(name='body'),
}

/**
 * @summary 取消资金账户低额预警
 *
 * @param request CancelFundAccountLowAvailableAmountAlarmRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelFundAccountLowAvailableAmountAlarmResponse
 */
async function cancelFundAccountLowAvailableAmountAlarmWithOptions(request: CancelFundAccountLowAvailableAmountAlarmRequest, runtime: Util.RuntimeOptions): CancelFundAccountLowAvailableAmountAlarmResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CancelFundAccountLowAvailableAmountAlarm',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 取消资金账户低额预警
 *
 * @param request CancelFundAccountLowAvailableAmountAlarmRequest
 * @return CancelFundAccountLowAvailableAmountAlarmResponse
 */
async function cancelFundAccountLowAvailableAmountAlarm(request: CancelFundAccountLowAvailableAmountAlarmRequest): CancelFundAccountLowAvailableAmountAlarmResponse {
  var runtime = new Util.RuntimeOptions{};
  return cancelFundAccountLowAvailableAmountAlarmWithOptions(request, runtime);
}

model CreateFundAccountTransferRequest {
  amount?: string(name='Amount', description='This parameter is required.', example='100'),
  currency?: string(name='Currency', description='This parameter is required.', example='CNY'),
  financeType?: string(name='FinanceType', description='This parameter is required.', example='cash'),
  fromFundAccountId?: long(name='FromFundAccountId', description='This parameter is required.', example='123212323'),
  remark?: string(name='Remark', description='This parameter is required.', example='转账的备注'),
  toFundAccountId?: long(name='ToFundAccountId', description='This parameter is required.', example='11112231'),
  transferType?: string(name='TransferType', description='This parameter is required.', example='grant'),
}

model CreateFundAccountTransferResponseBody = {
  metadata?: any(name='Metadata', example='{}'),
  requestId?: string(name='RequestId', example='1BB79-5B23-3EA-BB4F-352F93E'),
}

model CreateFundAccountTransferResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFundAccountTransferResponseBody(name='body'),
}

/**
 * @summary 创建资金账户划拨/回收
 *
 * @param request CreateFundAccountTransferRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFundAccountTransferResponse
 */
async function createFundAccountTransferWithOptions(request: CreateFundAccountTransferRequest, runtime: Util.RuntimeOptions): CreateFundAccountTransferResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.amount)) {
    body['Amount'] = request.amount;
  }
  if (!Util.isUnset(request.currency)) {
    body['Currency'] = request.currency;
  }
  if (!Util.isUnset(request.financeType)) {
    body['FinanceType'] = request.financeType;
  }
  if (!Util.isUnset(request.fromFundAccountId)) {
    body['FromFundAccountId'] = request.fromFundAccountId;
  }
  if (!Util.isUnset(request.remark)) {
    body['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.toFundAccountId)) {
    body['ToFundAccountId'] = request.toFundAccountId;
  }
  if (!Util.isUnset(request.transferType)) {
    body['TransferType'] = request.transferType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateFundAccountTransfer',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建资金账户划拨/回收
 *
 * @param request CreateFundAccountTransferRequest
 * @return CreateFundAccountTransferResponse
 */
async function createFundAccountTransfer(request: CreateFundAccountTransferRequest): CreateFundAccountTransferResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFundAccountTransferWithOptions(request, runtime);
}

model DeleteCouponDeductTagRequest {
  couponId?: string(name='CouponId'),
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.'),
    }
  ](name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  tagKeys?: [ string ](name='TagKeys'),
}

model DeleteCouponDeductTagShrinkRequest {
  couponId?: string(name='CouponId'),
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  tagKeysShrink?: string(name='TagKeys'),
}

model DeleteCouponDeductTagResponseBody = {
  data?: boolean(name='Data'),
  requestId?: string(name='RequestId'),
}

model DeleteCouponDeductTagResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteCouponDeductTagResponseBody(name='body'),
}

/**
 * @summary 删除优惠券的抵扣标签
 *
 * @param tmpReq DeleteCouponDeductTagRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteCouponDeductTagResponse
 */
async function deleteCouponDeductTagWithOptions(tmpReq: DeleteCouponDeductTagRequest, runtime: Util.RuntimeOptions): DeleteCouponDeductTagResponse {
  Util.validateModel(tmpReq);
  var request = new DeleteCouponDeductTagShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  if (!Util.isUnset(tmpReq.tagKeys)) {
    request.tagKeysShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tagKeys, 'TagKeys', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.couponId)) {
    query['CouponId'] = request.couponId;
  }
  if (!Util.isUnset(request.ecIdAccountIdsShrink)) {
    query['EcIdAccountIds'] = request.ecIdAccountIdsShrink;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  if (!Util.isUnset(request.tagKeysShrink)) {
    query['TagKeys'] = request.tagKeysShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteCouponDeductTag',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除优惠券的抵扣标签
 *
 * @param request DeleteCouponDeductTagRequest
 * @return DeleteCouponDeductTagResponse
 */
async function deleteCouponDeductTag(request: DeleteCouponDeductTagRequest): DeleteCouponDeductTagResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteCouponDeductTagWithOptions(request, runtime);
}

model DescribeCouponRequest {
  couponId?: long(name='CouponId', example='351430260343'),
  couponNo?: string(name='CouponNo', example='554863270150'),
  couponType?: string(name='CouponType', example='CERTAIN'),
  currentPage?: int32(name='CurrentPage', description='This parameter is required.', example='1'),
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.', example='1501603440974415'),
    }
  ](name='EcIdAccountIds'),
  effectiveEndTime?: long(name='EffectiveEndTime', example='1708423156000'),
  effectiveStartTime?: long(name='EffectiveStartTime', example='1684750028000'),
  expireEndDate?: long(name='ExpireEndDate', example='1708423156000'),
  expireStartDate?: long(name='ExpireStartDate', example='1684750028000'),
  nbid?: string(name='Nbid', example='2684201000001'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='20'),
  status?: string(name='Status', example='AVAILABLE'),
}

model DescribeCouponShrinkRequest {
  couponId?: long(name='CouponId', example='351430260343'),
  couponNo?: string(name='CouponNo', example='554863270150'),
  couponType?: string(name='CouponType', example='CERTAIN'),
  currentPage?: int32(name='CurrentPage', description='This parameter is required.', example='1'),
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  effectiveEndTime?: long(name='EffectiveEndTime', example='1708423156000'),
  effectiveStartTime?: long(name='EffectiveStartTime', example='1684750028000'),
  expireEndDate?: long(name='ExpireEndDate', example='1708423156000'),
  expireStartDate?: long(name='ExpireStartDate', example='1684750028000'),
  nbid?: string(name='Nbid', example='2684201000001'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='20'),
  status?: string(name='Status', example='AVAILABLE'),
}

model DescribeCouponResponseBody = {
  currentPage?: int32(name='CurrentPage', example='1'),
  data?: [ 
    {
      amount?: string(name='Amount', example='9929.750000'),
      certainAmount?: string(name='CertainAmount'),
      couponId?: long(name='CouponId', example='59243658'),
      couponNo?: string(name='CouponNo', example='731074910070'),
      couponType?: string(name='CouponType', example='CERTAIN'),
      couponTypeName?: string(name='CouponTypeName'),
      currency?: string(name='Currency', example='CNY'),
      endTime?: string(name='EndTime', example='2021-03-06T15:12Z'),
      gmtCreate?: string(name='GmtCreate', example='2021-03-02T15:12Z'),
      itemNames?: [ string ](name='ItemNames'),
      moneyLimit?: string(name='MoneyLimit'),
      orderTimeRule?: string(name='OrderTimeRule'),
      remainAmount?: string(name='RemainAmount', example='100.00'),
      remark?: string(name='Remark'),
      shareUidList?: [ 
        {
          uid?: string(name='Uid', example='1902671110151254'),
          userNick?: string(name='UserNick'),
        }
      ](name='ShareUidList'),
      showSetDeductTagButton?: boolean(name='ShowSetDeductTagButton', example='true'),
      site?: string(name='Site', example='CHINA'),
      siteName?: string(name='SiteName'),
      startTime?: string(name='StartTime', example='2021-03-02T15:12Z'),
      status?: string(name='Status', example='Available'),
      suitAccount?: string(name='SuitAccount', example='1902671110151254'),
      suitItemType?: string(name='SuitItemType', example='all'),
      universalType?: string(name='UniversalType', example='UNIVERSAL'),
      yhOrderTypes?: [ string ](name='YhOrderTypes'),
    }
  ](name='Data'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='C880B065-A781-4F19-B6DD-3E0E3B715C64'),
  totalCount?: int32(name='TotalCount', example='2'),
}

model DescribeCouponResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCouponResponseBody(name='body'),
}

/**
 * @summary 查询优惠券列表
 *
 * @param tmpReq DescribeCouponRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCouponResponse
 */
async function describeCouponWithOptions(tmpReq: DescribeCouponRequest, runtime: Util.RuntimeOptions): DescribeCouponResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeCouponShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCoupon',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询优惠券列表
 *
 * @param request DescribeCouponRequest
 * @return DescribeCouponResponse
 */
async function describeCoupon(request: DescribeCouponRequest): DescribeCouponResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCouponWithOptions(request, runtime);
}

model DescribeCouponItemListRequest {
  couponId?: long(name='CouponId', example='59104570'),
  currentPage?: int32(name='CurrentPage', example='1'),
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.', example='1004064243473974'),
    }
  ](name='EcIdAccountIds'),
  name?: string(name='Name'),
  nbid?: string(name='Nbid', example='2684201000001'),
  pageSize?: int32(name='PageSize', example='20'),
}

model DescribeCouponItemListShrinkRequest {
  couponId?: long(name='CouponId', example='59104570'),
  currentPage?: int32(name='CurrentPage', example='1'),
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  name?: string(name='Name'),
  nbid?: string(name='Nbid', example='2684201000001'),
  pageSize?: int32(name='PageSize', example='20'),
}

model DescribeCouponItemListResponseBody = {
  currentPage?: int32(name='CurrentPage', example='1'),
  data?: [ 
    {
      code?: string(name='Code', example='vm'),
      name?: string(name='Name'),
    }
  ](name='Data'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='EAE08A27-386C-579E-966D-8853EC3C5D0E'),
  totalCount?: int32(name='TotalCount', example='5'),
}

model DescribeCouponItemListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCouponItemListResponseBody(name='body'),
}

/**
 * @summary 查询优惠券可用商品列表
 *
 * @param tmpReq DescribeCouponItemListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCouponItemListResponse
 */
async function describeCouponItemListWithOptions(tmpReq: DescribeCouponItemListRequest, runtime: Util.RuntimeOptions): DescribeCouponItemListResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeCouponItemListShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCouponItemList',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询优惠券可用商品列表
 *
 * @param request DescribeCouponItemListRequest
 * @return DescribeCouponItemListResponse
 */
async function describeCouponItemList(request: DescribeCouponItemListRequest): DescribeCouponItemListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCouponItemListWithOptions(request, runtime);
}

model DescribeUserSpnSummaryInfoRequest {
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.'),
    }
  ](name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
}

model DescribeUserSpnSummaryInfoShrinkRequest {
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
}

model DescribeUserSpnSummaryInfoResponseBody = {
  instanceFamilyList?: [ string ](name='InstanceFamilyList'),
  regionList?: [ 
    {
      regionCode?: string(name='RegionCode'),
      regionName?: string(name='RegionName'),
    }
  ](name='RegionList'),
  requestId?: string(name='RequestId'),
  spnCodeAndTypeList?: [ 
    {
      productCode?: string(name='ProductCode'),
      spnCommodityCode?: string(name='SpnCommodityCode'),
      spnType?: string(name='SpnType'),
      spnTypeName?: string(name='SpnTypeName'),
    }
  ](name='SpnCodeAndTypeList'),
}

model DescribeUserSpnSummaryInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserSpnSummaryInfoResponseBody(name='body'),
}

/**
 * @summary 获取客户使用SPN的概述信息
 *
 * @param tmpReq DescribeUserSpnSummaryInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserSpnSummaryInfoResponse
 */
async function describeUserSpnSummaryInfoWithOptions(tmpReq: DescribeUserSpnSummaryInfoRequest, runtime: Util.RuntimeOptions): DescribeUserSpnSummaryInfoResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeUserSpnSummaryInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.ecIdAccountIdsShrink)) {
    query['EcIdAccountIds'] = request.ecIdAccountIdsShrink;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeUserSpnSummaryInfo',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取客户使用SPN的概述信息
 *
 * @param request DescribeUserSpnSummaryInfoRequest
 * @return DescribeUserSpnSummaryInfoResponse
 */
async function describeUserSpnSummaryInfo(request: DescribeUserSpnSummaryInfoRequest): DescribeUserSpnSummaryInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeUserSpnSummaryInfoWithOptions(request, runtime);
}

model GetFundAccountAvailableAmountRequest {
  fundAccountId?: string(name='FundAccountId', example='12332112'),
}

model GetFundAccountAvailableAmountResponseBody = {
  availableAmount?: string(name='AvailableAmount', example='100'),
  availableCreditAmount?: string(name='AvailableCreditAmount', example='50'),
  bankAcceptanceAmount?: string(name='BankAcceptanceAmount', example='0'),
  cashAmount?: string(name='CashAmount', example='50'),
  creditAmount?: string(name='CreditAmount', example='100'),
  creditRefundAmount?: string(name='CreditRefundAmount', example='0'),
  creditUser?: boolean(name='CreditUser'),
  currency?: string(name='Currency', example='CNY'),
  currentMonthUnclearedAmount?: string(name='CurrentMonthUnclearedAmount', example='20'),
  extendLedgerList?: [ 
    {
      currency?: string(name='Currency', example='CNY'),
      ledgerName?: string(name='LedgerName', example='应付对冲账本'),
      originalAmount?: string(name='OriginalAmount', example='50'),
    }
  ](name='ExtendLedgerList'),
  fundAccountId?: string(name='FundAccountId', example='12332112'),
  fundAccountOwnerAccountId?: string(name='FundAccountOwnerAccountId', example='1344312434'),
  fundAccountStatus?: string(name='FundAccountStatus', example='valid'),
  fundAccountType?: string(name='FundAccountType', example='REDIRECT_USER'),
  historyMonthUnclearedAmount?: string(name='HistoryMonthUnclearedAmount', example='30'),
  metadata?: any(name='Metadata', example='{}'),
  negativeBillAmount?: string(name='NegativeBillAmount', example='0'),
  originalCashAmountList?: [ 
    {
      amount?: string(name='Amount', example='10'),
      currency?: string(name='Currency', example='USD'),
    }
  ](name='OriginalCashAmountList'),
  quotaAmount?: string(name='QuotaAmount', example='20'),
  quotaConsumedAmount?: string(name='QuotaConsumedAmount', example='10'),
  requestId?: string(name='RequestId', example='F96A2D13-7509-5DF9-A60E-E7E3A3CB68E8'),
  unclearedAmount?: string(name='UnclearedAmount', example='50'),
}

model GetFundAccountAvailableAmountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFundAccountAvailableAmountResponseBody(name='body'),
}

/**
 * @summary 查询资金账户可用金
 *
 * @param request GetFundAccountAvailableAmountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFundAccountAvailableAmountResponse
 */
async function getFundAccountAvailableAmountWithOptions(request: GetFundAccountAvailableAmountRequest, runtime: Util.RuntimeOptions): GetFundAccountAvailableAmountResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFundAccountAvailableAmount',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户可用金
 *
 * @param request GetFundAccountAvailableAmountRequest
 * @return GetFundAccountAvailableAmountResponse
 */
async function getFundAccountAvailableAmount(request: GetFundAccountAvailableAmountRequest): GetFundAccountAvailableAmountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFundAccountAvailableAmountWithOptions(request, runtime);
}

model GetFundAccountCanAllocateCreditAmountRequest {
  fundAccountId?: long(name='FundAccountId', example='1233231'),
}

model GetFundAccountCanAllocateCreditAmountResponseBody = {
  ecid?: string(name='Ecid', example='2032123221'),
  ecidAllocatedCreditAmount?: string(name='EcidAllocatedCreditAmount', example='300'),
  ecidCreditAmount?: string(name='EcidCreditAmount', example='1000'),
  fundAccountEcid?: string(name='FundAccountEcid', example='202321232'),
  fundAccountId?: long(name='FundAccountId', example='12332112'),
  fundAccountName?: string(name='FundAccountName', example='云某的名称'),
  fundAccountOwnerAccountId?: long(name='FundAccountOwnerAccountId', example='123433121'),
  maxCanAllocateCreditAmount?: string(name='MaxCanAllocateCreditAmount', example='1500'),
  metadata?: any(name='Metadata', example='{}'),
  minCanAllocateCreditAmount?: string(name='MinCanAllocateCreditAmount', example='200'),
  nbid?: string(name='Nbid', example='2684210001'),
  requestId?: string(name='RequestId', example='CC706AAC-75A6-55B5-9AB7-7D171C6C7655'),
  site?: string(name='Site', example='26842'),
}

model GetFundAccountCanAllocateCreditAmountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFundAccountCanAllocateCreditAmountResponseBody(name='body'),
}

/**
 * @summary 查询资金账户可分配信控额度
 *
 * @param request GetFundAccountCanAllocateCreditAmountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFundAccountCanAllocateCreditAmountResponse
 */
async function getFundAccountCanAllocateCreditAmountWithOptions(request: GetFundAccountCanAllocateCreditAmountRequest, runtime: Util.RuntimeOptions): GetFundAccountCanAllocateCreditAmountResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFundAccountCanAllocateCreditAmount',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户可分配信控额度
 *
 * @param request GetFundAccountCanAllocateCreditAmountRequest
 * @return GetFundAccountCanAllocateCreditAmountResponse
 */
async function getFundAccountCanAllocateCreditAmount(request: GetFundAccountCanAllocateCreditAmountRequest): GetFundAccountCanAllocateCreditAmountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFundAccountCanAllocateCreditAmountWithOptions(request, runtime);
}

model GetFundAccountCanRecycleAmountRequest {
  currency?: string(name='Currency', description='This parameter is required.', example='CNY'),
  recycleFromFundAccountId?: string(name='RecycleFromFundAccountId', example='122321223'),
}

model GetFundAccountCanRecycleAmountResponseBody = {
  availableAmount?: string(name='AvailableAmount', example='300'),
  currency?: string(name='Currency', example='CNY'),
  metadata?: any(name='Metadata', example='{}'),
  recycleFromFundAccountId?: string(name='RecycleFromFundAccountId', example='1232122132'),
  recycleToFundAccountList?: [ 
    {
      fundAccountId?: string(name='FundAccountId', example='122323121'),
      fundAccountName?: string(name='FundAccountName', example='云某的账户'),
      fundAccountOwnerAccountId?: string(name='FundAccountOwnerAccountId', example='183221321'),
      maxRecyclableAmount?: string(name='MaxRecyclableAmount', example='120'),
      originalTransferRemainAmount?: string(name='OriginalTransferRemainAmount', example='120'),
    }
  ](name='RecycleToFundAccountList'),
  requestId?: string(name='RequestId', example='6000EE23-274B-4E07-A697-FF2E999520A4'),
  transferAmount?: string(name='TransferAmount', example='200'),
}

model GetFundAccountCanRecycleAmountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFundAccountCanRecycleAmountResponseBody(name='body'),
}

/**
 * @summary 查询资金账户可回收金额
 *
 * @param request GetFundAccountCanRecycleAmountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFundAccountCanRecycleAmountResponse
 */
async function getFundAccountCanRecycleAmountWithOptions(request: GetFundAccountCanRecycleAmountRequest, runtime: Util.RuntimeOptions): GetFundAccountCanRecycleAmountResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currency)) {
    body['Currency'] = request.currency;
  }
  if (!Util.isUnset(request.recycleFromFundAccountId)) {
    body['RecycleFromFundAccountId'] = request.recycleFromFundAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFundAccountCanRecycleAmount',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户可回收金额
 *
 * @param request GetFundAccountCanRecycleAmountRequest
 * @return GetFundAccountCanRecycleAmountResponse
 */
async function getFundAccountCanRecycleAmount(request: GetFundAccountCanRecycleAmountRequest): GetFundAccountCanRecycleAmountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFundAccountCanRecycleAmountWithOptions(request, runtime);
}

model GetFundAccountCanTransferAmountRequest {
  currency?: string(name='Currency', description='This parameter is required.', example='CNY'),
  fundAccountId?: string(name='FundAccountId', example='123212'),
}

model GetFundAccountCanTransferAmountResponseBody = {
  availableAmount?: string(name='AvailableAmount', example='100'),
  cashAmount?: string(name='CashAmount', example='500'),
  currency?: string(name='Currency', example='CNY'),
  fundAccountEcid?: string(name='FundAccountEcid', example='2032121324'),
  fundAccountId?: long(name='FundAccountId', example='12332112'),
  fundAccountName?: string(name='FundAccountName', example='云某的账户'),
  fundAccountOwnerAccountId?: long(name='FundAccountOwnerAccountId', example='154738212323'),
  maxTransferableAmount?: string(name='MaxTransferableAmount', example='100'),
  metadata?: any(name='Metadata', example='{}'),
  nbid?: string(name='Nbid', example='2684210001'),
  requestId?: string(name='RequestId', example='6000EE23-274B-4E07-A697-FF2E999520A4'),
  site?: string(name='Site', example='26842'),
  transferAmount?: string(name='TransferAmount', example='100'),
}

model GetFundAccountCanTransferAmountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFundAccountCanTransferAmountResponseBody(name='body'),
}

/**
 * @summary 查询资金账户的可转出金额
 *
 * @param request GetFundAccountCanTransferAmountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFundAccountCanTransferAmountResponse
 */
async function getFundAccountCanTransferAmountWithOptions(request: GetFundAccountCanTransferAmountRequest, runtime: Util.RuntimeOptions): GetFundAccountCanTransferAmountResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.currency)) {
    body['Currency'] = request.currency;
  }
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFundAccountCanTransferAmount',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户的可转出金额
 *
 * @param request GetFundAccountCanTransferAmountRequest
 * @return GetFundAccountCanTransferAmountResponse
 */
async function getFundAccountCanTransferAmount(request: GetFundAccountCanTransferAmountRequest): GetFundAccountCanTransferAmountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFundAccountCanTransferAmountWithOptions(request, runtime);
}

model GetFundAccountCanWithdrawAmountRequest {
  fundAccountId?: long(name='FundAccountId', example='123212232'),
}

model GetFundAccountCanWithdrawAmountResponseBody = {
  canOriginalWithdrawAmount?: string(name='CanOriginalWithdrawAmount', example='400'),
  canWithdrawAmount?: string(name='CanWithdrawAmount', example='500'),
  cannotOriginalWithdrawAmount?: string(name='CannotOriginalWithdrawAmount', example='100'),
  cashAmount?: string(name='CashAmount', example='1000'),
  creditMemoAmount?: string(name='CreditMemoAmount', example='100'),
  currentMonthUnclearedAmount?: string(name='CurrentMonthUnclearedAmount', example='200'),
  historyMonthUnclearedAmount?: string(name='HistoryMonthUnclearedAmount', example='100'),
  metadata?: any(name='Metadata', example='{}'),
  payAsYouGoReversedAmount?: string(name='PayAsYouGoReversedAmount', example='100'),
  requestId?: string(name='RequestId', example='DF58589C-A06C-4224-8615-7797E6474FA3'),
  transferAmount?: string(name='TransferAmount', example='0'),
}

model GetFundAccountCanWithdrawAmountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFundAccountCanWithdrawAmountResponseBody(name='body'),
}

/**
 * @summary 查询资金账户可提现金额
 *
 * @param request GetFundAccountCanWithdrawAmountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFundAccountCanWithdrawAmountResponse
 */
async function getFundAccountCanWithdrawAmountWithOptions(request: GetFundAccountCanWithdrawAmountRequest, runtime: Util.RuntimeOptions): GetFundAccountCanWithdrawAmountResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFundAccountCanWithdrawAmount',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户可提现金额
 *
 * @param request GetFundAccountCanWithdrawAmountRequest
 * @return GetFundAccountCanWithdrawAmountResponse
 */
async function getFundAccountCanWithdrawAmount(request: GetFundAccountCanWithdrawAmountRequest): GetFundAccountCanWithdrawAmountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFundAccountCanWithdrawAmountWithOptions(request, runtime);
}

model GetFundAccountLowAvailableAmountAlarmRequest {
  fundAccountId?: long(name='FundAccountId', example='12332112'),
}

model GetFundAccountLowAvailableAmountAlarmResponseBody = {
  alarmEnabled?: boolean(name='AlarmEnabled'),
  metadata?: any(name='Metadata', example='{}'),
  requestId?: string(name='RequestId', example='6000EE23-274B-4E07-A697-FF2E999520A4'),
  thresholdAmount?: string(name='ThresholdAmount', example='100'),
}

model GetFundAccountLowAvailableAmountAlarmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFundAccountLowAvailableAmountAlarmResponseBody(name='body'),
}

/**
 * @summary 查询资金账户低额预警
 *
 * @param request GetFundAccountLowAvailableAmountAlarmRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFundAccountLowAvailableAmountAlarmResponse
 */
async function getFundAccountLowAvailableAmountAlarmWithOptions(request: GetFundAccountLowAvailableAmountAlarmRequest, runtime: Util.RuntimeOptions): GetFundAccountLowAvailableAmountAlarmResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFundAccountLowAvailableAmountAlarm',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户低额预警
 *
 * @param request GetFundAccountLowAvailableAmountAlarmRequest
 * @return GetFundAccountLowAvailableAmountAlarmResponse
 */
async function getFundAccountLowAvailableAmountAlarm(request: GetFundAccountLowAvailableAmountAlarmRequest): GetFundAccountLowAvailableAmountAlarmResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFundAccountLowAvailableAmountAlarmWithOptions(request, runtime);
}

model GetFundAccountTransactionDetailsRequest {
  billNumber?: string(name='BillNumber', example='2023212312321'),
  channelTransactionNumber?: string(name='ChannelTransactionNumber', example='20250312334312322'),
  currentPage?: int32(name='CurrentPage', example='1'),
  endTime?: long(name='EndTime', example='1735664561000'),
  fundAccountId?: long(name='FundAccountId', example='123221232'),
  pageSize?: int32(name='PageSize', example='20'),
  startTime?: long(name='StartTime', example='1735664461000'),
  transactionChannelList?: [ string ](name='TransactionChannelList'),
  transactionDirection?: string(name='TransactionDirection', example='IN'),
  transactionNumber?: long(name='TransactionNumber', example='543231231'),
  transactionType?: string(name='TransactionType', example='CHARGE'),
  transactionTypeList?: [ string ](name='TransactionTypeList'),
}

model GetFundAccountTransactionDetailsShrinkRequest {
  billNumber?: string(name='BillNumber', example='2023212312321'),
  channelTransactionNumber?: string(name='ChannelTransactionNumber', example='20250312334312322'),
  currentPage?: int32(name='CurrentPage', example='1'),
  endTime?: long(name='EndTime', example='1735664561000'),
  fundAccountId?: long(name='FundAccountId', example='123221232'),
  pageSize?: int32(name='PageSize', example='20'),
  startTime?: long(name='StartTime', example='1735664461000'),
  transactionChannelListShrink?: string(name='TransactionChannelList'),
  transactionDirection?: string(name='TransactionDirection', example='IN'),
  transactionNumber?: long(name='TransactionNumber', example='543231231'),
  transactionType?: string(name='TransactionType', example='CHARGE'),
  transactionTypeListShrink?: string(name='TransactionTypeList'),
}

model GetFundAccountTransactionDetailsResponseBody = {
  currentPage?: int32(name='CurrentPage', example='1'),
  data?: [ 
    {
      balance?: string(name='Balance', example='5'),
      billNumber?: string(name='BillNumber', example='2323203243'),
      channelTransactionNumber?: string(name='ChannelTransactionNumber', example='20244389232'),
      currency?: string(name='Currency', example='USD'),
      fundAccountEcid?: string(name='FundAccountEcid', example='23473943'),
      fundAccountId?: long(name='FundAccountId', example='1232121'),
      fundAccountName?: string(name='FundAccountName', example='云某的名称'),
      fundAccountOwnerAccountId?: long(name='FundAccountOwnerAccountId', example='32343231'),
      fundType?: string(name='FundType', example='ACCT_BOOK'),
      nbid?: string(name='Nbid', example='2684210001'),
      remark?: string(name='Remark', example='订单备注'),
      site?: string(name='Site', example='26842'),
      transactionAccount?: string(name='TransactionAccount', example='186****3975'),
      transactionAmount?: string(name='TransactionAmount', example='10'),
      transactionChannel?: string(name='TransactionChannel', example='ALIPAY'),
      transactionDirection?: string(name='TransactionDirection', example='IN'),
      transactionNumber?: long(name='TransactionNumber', example='5423121'),
      transactionTime?: string(name='TransactionTime', example='2024-12-01 12:00:00'),
      transactionType?: string(name='TransactionType', example='CHARGE'),
    }
  ](name='Data'),
  metadata?: any(name='Metadata', example='{}'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='D6E068C3-25BC-455A-85FE-45F0B22ECB1F'),
  totalCount?: int32(name='TotalCount', example='30'),
}

model GetFundAccountTransactionDetailsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFundAccountTransactionDetailsResponseBody(name='body'),
}

/**
 * @summary 查询资金账户收支明细
 *
 * @param tmpReq GetFundAccountTransactionDetailsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFundAccountTransactionDetailsResponse
 */
async function getFundAccountTransactionDetailsWithOptions(tmpReq: GetFundAccountTransactionDetailsRequest, runtime: Util.RuntimeOptions): GetFundAccountTransactionDetailsResponse {
  Util.validateModel(tmpReq);
  var request = new GetFundAccountTransactionDetailsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.transactionChannelList)) {
    request.transactionChannelListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.transactionChannelList, 'TransactionChannelList', 'json');
  }
  if (!Util.isUnset(tmpReq.transactionTypeList)) {
    request.transactionTypeListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.transactionTypeList, 'TransactionTypeList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.billNumber)) {
    body['BillNumber'] = request.billNumber;
  }
  if (!Util.isUnset(request.channelTransactionNumber)) {
    body['ChannelTransactionNumber'] = request.channelTransactionNumber;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.transactionChannelListShrink)) {
    body['TransactionChannelList'] = request.transactionChannelListShrink;
  }
  if (!Util.isUnset(request.transactionDirection)) {
    body['TransactionDirection'] = request.transactionDirection;
  }
  if (!Util.isUnset(request.transactionNumber)) {
    body['TransactionNumber'] = request.transactionNumber;
  }
  if (!Util.isUnset(request.transactionType)) {
    body['TransactionType'] = request.transactionType;
  }
  if (!Util.isUnset(request.transactionTypeListShrink)) {
    body['TransactionTypeList'] = request.transactionTypeListShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetFundAccountTransactionDetails',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户收支明细
 *
 * @param request GetFundAccountTransactionDetailsRequest
 * @return GetFundAccountTransactionDetailsResponse
 */
async function getFundAccountTransactionDetails(request: GetFundAccountTransactionDetailsRequest): GetFundAccountTransactionDetailsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFundAccountTransactionDetailsWithOptions(request, runtime);
}

model GetSavingPlanDeductableCommodityRequest {
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.'),
    }
  ](name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
}

model GetSavingPlanDeductableCommodityShrinkRequest {
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
}

model GetSavingPlanDeductableCommodityResponseBody = {
  data?: [ 
    {
      activityId?: long(name='ActivityId'),
      commodityCode?: string(name='CommodityCode'),
      commodityId?: long(name='CommodityId'),
      commodityName?: string(name='CommodityName'),
      cycleList?: [ 
        {
          code?: string(name='Code'),
          name?: string(name='Name'),
        }
      ](name='CycleList'),
      filterModules?: [ 
        {
          moduleCode?: string(name='ModuleCode'),
          moduleId?: long(name='ModuleId'),
          moduleName?: string(name='ModuleName'),
        }
      ](name='FilterModules'),
      itemCode?: string(name='ItemCode'),
      itemId?: long(name='ItemId'),
      itemName?: string(name='ItemName'),
      moduleMapList?: [ 
        {
          filterModules?: [ 
            {
              moduleCode?: string(name='ModuleCode'),
              moduleId?: long(name='ModuleId'),
              moduleName?: string(name='ModuleName'),
            }
          ](name='FilterModules'),
          moduleCode?: string(name='ModuleCode'),
          moduleId?: long(name='ModuleId'),
          moduleName?: string(name='ModuleName'),
          showModules?: [ 
            {
              moduleCode?: string(name='ModuleCode'),
              moduleId?: long(name='ModuleId'),
              moduleName?: string(name='ModuleName'),
            }
          ](name='ShowModules'),
          spnTypeList?: [ string ](name='SpnTypeList'),
          spnTypeMapList?: [ map[string]DataModuleMapListSpnTypeMapListValue ](name='SpnTypeMapList'),
          spnTypeNameList?: [ 
            {
              code?: string(name='Code'),
              name?: string(name='Name'),
            }
          ](name='SpnTypeNameList'),
        }
      ](name='ModuleMapList'),
      payModeList?: [ 
        {
          code?: string(name='Code'),
          name?: string(name='Name'),
        }
      ](name='PayModeList'),
      pricingModules?: [ 
        {
          moduleCode?: string(name='ModuleCode'),
          moduleId?: long(name='ModuleId'),
          moduleName?: string(name='ModuleName'),
        }
      ](name='PricingModules'),
      spnCommodityCode?: string(name='SpnCommodityCode'),
      spnCommodityName?: string(name='SpnCommodityName'),
      spnDiscountConfigType?: string(name='SpnDiscountConfigType'),
      stepPriceMap?: map[string][ DataStepPriceMapValue       ](name='StepPriceMap'),
    }
  ](name='Data'),
  requestId?: string(name='RequestId'),
}

model GetSavingPlanDeductableCommodityResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSavingPlanDeductableCommodityResponseBody(name='body'),
}

/**
 * @summary 获取节省计划及可抵扣商品信息
 *
 * @param tmpReq GetSavingPlanDeductableCommodityRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSavingPlanDeductableCommodityResponse
 */
async function getSavingPlanDeductableCommodityWithOptions(tmpReq: GetSavingPlanDeductableCommodityRequest, runtime: Util.RuntimeOptions): GetSavingPlanDeductableCommodityResponse {
  Util.validateModel(tmpReq);
  var request = new GetSavingPlanDeductableCommodityShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.ecIdAccountIdsShrink)) {
    query['EcIdAccountIds'] = request.ecIdAccountIdsShrink;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSavingPlanDeductableCommodity',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取节省计划及可抵扣商品信息
 *
 * @param request GetSavingPlanDeductableCommodityRequest
 * @return GetSavingPlanDeductableCommodityResponse
 */
async function getSavingPlanDeductableCommodity(request: GetSavingPlanDeductableCommodityRequest): GetSavingPlanDeductableCommodityResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSavingPlanDeductableCommodityWithOptions(request, runtime);
}

model GetSavingPlanShareAccountsRequest {
  currentPage?: int32(name='CurrentPage'),
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.'),
    }
  ](name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  pageSize?: int32(name='PageSize'),
  spnInstanceCode?: string(name='SpnInstanceCode'),
}

model GetSavingPlanShareAccountsShrinkRequest {
  currentPage?: int32(name='CurrentPage'),
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  pageSize?: int32(name='PageSize'),
  spnInstanceCode?: string(name='SpnInstanceCode'),
}

model GetSavingPlanShareAccountsResponseBody = {
  data?: [ 
    {
      accountId?: string(name='AccountId'),
      aliUid?: long(name='AliUid'),
      shareTimeList?: [ 
        {
          shareEndTime?: string(name='ShareEndTime'),
          shareStartTime?: string(name='ShareStartTime'),
        }
      ](name='ShareTimeList'),
    }
  ](name='Data'),
  requestId?: string(name='RequestId'),
}

model GetSavingPlanShareAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSavingPlanShareAccountsResponseBody(name='body'),
}

/**
 * @summary 获取节省计划实例共享账号信息
 *
 * @param tmpReq GetSavingPlanShareAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSavingPlanShareAccountsResponse
 */
async function getSavingPlanShareAccountsWithOptions(tmpReq: GetSavingPlanShareAccountsRequest, runtime: Util.RuntimeOptions): GetSavingPlanShareAccountsResponse {
  Util.validateModel(tmpReq);
  var request = new GetSavingPlanShareAccountsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.ecIdAccountIdsShrink)) {
    query['EcIdAccountIds'] = request.ecIdAccountIdsShrink;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.spnInstanceCode)) {
    query['SpnInstanceCode'] = request.spnInstanceCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSavingPlanShareAccounts',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取节省计划实例共享账号信息
 *
 * @param request GetSavingPlanShareAccountsRequest
 * @return GetSavingPlanShareAccountsResponse
 */
async function getSavingPlanShareAccounts(request: GetSavingPlanShareAccountsRequest): GetSavingPlanShareAccountsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSavingPlanShareAccountsWithOptions(request, runtime);
}

model GetSavingPlanUserDeductRuleRequest {
  currentPage?: int32(name='CurrentPage'),
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.'),
    }
  ](name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  pageSize?: int32(name='PageSize'),
  spnInstanceCode?: string(name='SpnInstanceCode'),
}

model GetSavingPlanUserDeductRuleShrinkRequest {
  currentPage?: int32(name='CurrentPage'),
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  pageSize?: int32(name='PageSize'),
  spnInstanceCode?: string(name='SpnInstanceCode'),
}

model GetSavingPlanUserDeductRuleResponseBody = {
  data?: [ 
    {
      commodityCode?: string(name='CommodityCode'),
      commodityName?: string(name='CommodityName'),
      moduleCode?: string(name='ModuleCode'),
      moduleName?: string(name='ModuleName'),
      skipDeduct?: boolean(name='SkipDeduct'),
    }
  ](name='Data'),
  requestId?: string(name='RequestId'),
}

model GetSavingPlanUserDeductRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSavingPlanUserDeductRuleResponseBody(name='body'),
}

/**
 * @summary 获取节省计划实例客户自定义规则
 *
 * @param tmpReq GetSavingPlanUserDeductRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSavingPlanUserDeductRuleResponse
 */
async function getSavingPlanUserDeductRuleWithOptions(tmpReq: GetSavingPlanUserDeductRuleRequest, runtime: Util.RuntimeOptions): GetSavingPlanUserDeductRuleResponse {
  Util.validateModel(tmpReq);
  var request = new GetSavingPlanUserDeductRuleShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.ecIdAccountIdsShrink)) {
    query['EcIdAccountIds'] = request.ecIdAccountIdsShrink;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.spnInstanceCode)) {
    query['SpnInstanceCode'] = request.spnInstanceCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSavingPlanUserDeductRule',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取节省计划实例客户自定义规则
 *
 * @param request GetSavingPlanUserDeductRuleRequest
 * @return GetSavingPlanUserDeductRuleResponse
 */
async function getSavingPlanUserDeductRule(request: GetSavingPlanUserDeductRuleRequest): GetSavingPlanUserDeductRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSavingPlanUserDeductRuleWithOptions(request, runtime);
}

model ListCouponDeductTagRequest {
  couponId?: string(name='CouponId'),
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId', description='This parameter is required.'),
    }
  ](name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
}

model ListCouponDeductTagShrinkRequest {
  couponId?: string(name='CouponId'),
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
}

model ListCouponDeductTagResponseBody = {
  data?: [ 
    {
      key?: string(name='Key'),
      value?: string(name='Value'),
    }
  ](name='Data'),
  requestId?: string(name='RequestId'),
}

model ListCouponDeductTagResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListCouponDeductTagResponseBody(name='body'),
}

/**
 * @summary 查询优惠券设置的抵扣标签
 *
 * @param tmpReq ListCouponDeductTagRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListCouponDeductTagResponse
 */
async function listCouponDeductTagWithOptions(tmpReq: ListCouponDeductTagRequest, runtime: Util.RuntimeOptions): ListCouponDeductTagResponse {
  Util.validateModel(tmpReq);
  var request = new ListCouponDeductTagShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.couponId)) {
    query['CouponId'] = request.couponId;
  }
  if (!Util.isUnset(request.ecIdAccountIdsShrink)) {
    query['EcIdAccountIds'] = request.ecIdAccountIdsShrink;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCouponDeductTag',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询优惠券设置的抵扣标签
 *
 * @param request ListCouponDeductTagRequest
 * @return ListCouponDeductTagResponse
 */
async function listCouponDeductTag(request: ListCouponDeductTagRequest): ListCouponDeductTagResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCouponDeductTagWithOptions(request, runtime);
}

model ListFundAccountRequest {
  nbid?: string(name='Nbid', example='2084210001'),
  queryOnlyInUse?: boolean(name='QueryOnlyInUse'),
  queryOnlyManage?: boolean(name='QueryOnlyManage'),
}

model ListFundAccountResponseBody = {
  data?: [ 
    {
      createDate?: string(name='CreateDate', example='2024-12-30 12:00:00'),
      fundAccountAdminAccountId?: string(name='FundAccountAdminAccountId', example='1232121'),
      fundAccountAdminAccountName?: string(name='FundAccountAdminAccountName', example='云某的账户'),
      fundAccountId?: string(name='FundAccountId', example='1022231'),
      fundAccountName?: string(name='FundAccountName', example='云某的账户'),
      fundAccountOwnerAccountId?: string(name='FundAccountOwnerAccountId', example='132123211'),
      fundAccountStatus?: string(name='FundAccountStatus', example='VALID'),
      fundAccountType?: string(name='FundAccountType', example='DIRECT_USER'),
      nbid?: string(name='Nbid', example='2684210001'),
      permissions?: [ string ](name='Permissions'),
      site?: string(name='Site', example='26842'),
    }
  ](name='Data'),
  metadata?: any(name='Metadata', example='{}'),
  requestId?: string(name='RequestId', example='6000EE23-274B-4E07-A697-FF2E999520A4'),
}

model ListFundAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFundAccountResponseBody(name='body'),
}

/**
 * @summary 查询资金账户列表
 *
 * @param request ListFundAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFundAccountResponse
 */
async function listFundAccountWithOptions(request: ListFundAccountRequest, runtime: Util.RuntimeOptions): ListFundAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.queryOnlyInUse)) {
    body['QueryOnlyInUse'] = request.queryOnlyInUse;
  }
  if (!Util.isUnset(request.queryOnlyManage)) {
    body['QueryOnlyManage'] = request.queryOnlyManage;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListFundAccount',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户列表
 *
 * @param request ListFundAccountRequest
 * @return ListFundAccountResponse
 */
async function listFundAccount(request: ListFundAccountRequest): ListFundAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFundAccountWithOptions(request, runtime);
}

model ListFundAccountPayRelationRequest {
  currentPage?: int32(name='CurrentPage', example='1'),
  fundAccountId?: string(name='FundAccountId', description='This parameter is required.', example='12323123'),
  nbid?: string(name='Nbid', example='2684201000001'),
  pageSize?: int32(name='PageSize', example='20'),
  status?: string(name='Status', example='valid'),
}

model ListFundAccountPayRelationResponseBody = {
  currentPage?: int32(name='CurrentPage', example='1'),
  data?: [ 
    {
      accountId?: string(name='AccountId', example='32812132121'),
      accountName?: string(name='AccountName', example='云某的名称'),
      ecid?: string(name='Ecid', example='213231232'),
      effectiveTime?: string(name='EffectiveTime', example='2024-12-01 12:00:10'),
      fundAccountId?: string(name='FundAccountId', example='123231213'),
      fundAccountOwnerAccountId?: string(name='FundAccountOwnerAccountId', example='312328912'),
      ineffectiveTime?: string(name='IneffectiveTime', example='2025-01-01 12:12:12'),
      nbid?: string(name='Nbid', example='2684210001'),
      operatorName?: string(name='OperatorName', example='云某的名称'),
      operatorNo?: string(name='OperatorNo', example='1232343423'),
      operatorType?: string(name='OperatorType', example='aliyun_pk'),
      relationType?: string(name='RelationType', example='PAYMENT'),
      site?: string(name='Site', example='26842'),
      status?: string(name='Status', example='valid'),
    }
  ](name='Data'),
  metadata?: any(name='Metadata', example='{}'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='79EE7556-0CFD-44EB-9CD6-B3B526E3A85F'),
  totalCount?: int32(name='TotalCount', example='50'),
}

model ListFundAccountPayRelationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFundAccountPayRelationResponseBody(name='body'),
}

/**
 * @summary 查询资金账户的付款关系
 *
 * @param request ListFundAccountPayRelationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFundAccountPayRelationResponse
 */
async function listFundAccountPayRelationWithOptions(request: ListFundAccountPayRelationRequest, runtime: Util.RuntimeOptions): ListFundAccountPayRelationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListFundAccountPayRelation',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询资金账户的付款关系
 *
 * @param request ListFundAccountPayRelationRequest
 * @return ListFundAccountPayRelationResponse
 */
async function listFundAccountPayRelation(request: ListFundAccountPayRelationRequest): ListFundAccountPayRelationResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFundAccountPayRelationWithOptions(request, runtime);
}

model SetFundAccountCreditAmountRequest {
  creditAmount?: string(name='CreditAmount', description='This parameter is required.', example='500'),
  currency?: string(name='Currency', description='This parameter is required.', example='CNY'),
  fundAccountId?: long(name='FundAccountId', example='1232312'),
}

model SetFundAccountCreditAmountResponseBody = {
  metadata?: any(name='Metadata', example='{}'),
  requestId?: string(name='RequestId', example='79EE7556-0CFD-44EB-9CD6-B3B526E3A85F'),
}

model SetFundAccountCreditAmountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetFundAccountCreditAmountResponseBody(name='body'),
}

/**
 * @summary 设置资金账户的信控限额
 *
 * @param request SetFundAccountCreditAmountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetFundAccountCreditAmountResponse
 */
async function setFundAccountCreditAmountWithOptions(request: SetFundAccountCreditAmountRequest, runtime: Util.RuntimeOptions): SetFundAccountCreditAmountResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.creditAmount)) {
    body['CreditAmount'] = request.creditAmount;
  }
  if (!Util.isUnset(request.currency)) {
    body['Currency'] = request.currency;
  }
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SetFundAccountCreditAmount',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 设置资金账户的信控限额
 *
 * @param request SetFundAccountCreditAmountRequest
 * @return SetFundAccountCreditAmountResponse
 */
async function setFundAccountCreditAmount(request: SetFundAccountCreditAmountRequest): SetFundAccountCreditAmountResponse {
  var runtime = new Util.RuntimeOptions{};
  return setFundAccountCreditAmountWithOptions(request, runtime);
}

model SetFundAccountLowAvailableAmountAlarmRequest {
  fundAccountId?: long(name='FundAccountId', example='12321213'),
  thresholdAmount?: string(name='ThresholdAmount', example='100'),
}

model SetFundAccountLowAvailableAmountAlarmResponseBody = {
  data?: boolean(name='Data', example='true'),
  metadata?: any(name='Metadata', example='{}'),
  requestId?: string(name='RequestId', example='08108BF5-1AA3-518E-9986-95A3616E8DA9'),
}

model SetFundAccountLowAvailableAmountAlarmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetFundAccountLowAvailableAmountAlarmResponseBody(name='body'),
}

/**
 * @summary 设置资金账户低额预警
 *
 * @param request SetFundAccountLowAvailableAmountAlarmRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetFundAccountLowAvailableAmountAlarmResponse
 */
async function setFundAccountLowAvailableAmountAlarmWithOptions(request: SetFundAccountLowAvailableAmountAlarmRequest, runtime: Util.RuntimeOptions): SetFundAccountLowAvailableAmountAlarmResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.fundAccountId)) {
    body['FundAccountId'] = request.fundAccountId;
  }
  if (!Util.isUnset(request.thresholdAmount)) {
    body['ThresholdAmount'] = request.thresholdAmount;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SetFundAccountLowAvailableAmountAlarm',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 设置资金账户低额预警
 *
 * @param request SetFundAccountLowAvailableAmountAlarmRequest
 * @return SetFundAccountLowAvailableAmountAlarmResponse
 */
async function setFundAccountLowAvailableAmountAlarm(request: SetFundAccountLowAvailableAmountAlarmRequest): SetFundAccountLowAvailableAmountAlarmResponse {
  var runtime = new Util.RuntimeOptions{};
  return setFundAccountLowAvailableAmountAlarmWithOptions(request, runtime);
}

model SetSavingPlanUserDeductRuleRequest {
  ecIdAccountIds?: [ 
    {
      accountIds?: [ long ](name='AccountIds'),
      ecId?: string(name='EcId'),
    }
  ](name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  spnInstanceCode?: string(name='SpnInstanceCode'),
  userDeductRules?: [ 
    {
      commodityCode?: string(name='CommodityCode'),
      moduleCode?: string(name='ModuleCode'),
      skipDeduct?: boolean(name='SkipDeduct'),
    }
  ](name='UserDeductRules'),
}

model SetSavingPlanUserDeductRuleShrinkRequest {
  ecIdAccountIdsShrink?: string(name='EcIdAccountIds'),
  nbid?: string(name='Nbid'),
  spnInstanceCode?: string(name='SpnInstanceCode'),
  userDeductRulesShrink?: string(name='UserDeductRules'),
}

model SetSavingPlanUserDeductRuleResponseBody = {
  data?: boolean(name='Data'),
  requestId?: string(name='RequestId'),
}

model SetSavingPlanUserDeductRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetSavingPlanUserDeductRuleResponseBody(name='body'),
}

/**
 * @summary 设置节省计划用户级抵扣规则
 *
 * @param tmpReq SetSavingPlanUserDeductRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetSavingPlanUserDeductRuleResponse
 */
async function setSavingPlanUserDeductRuleWithOptions(tmpReq: SetSavingPlanUserDeductRuleRequest, runtime: Util.RuntimeOptions): SetSavingPlanUserDeductRuleResponse {
  Util.validateModel(tmpReq);
  var request = new SetSavingPlanUserDeductRuleShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ecIdAccountIds)) {
    request.ecIdAccountIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ecIdAccountIds, 'EcIdAccountIds', 'json');
  }
  if (!Util.isUnset(tmpReq.userDeductRules)) {
    request.userDeductRulesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.userDeductRules, 'UserDeductRules', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.ecIdAccountIdsShrink)) {
    query['EcIdAccountIds'] = request.ecIdAccountIdsShrink;
  }
  if (!Util.isUnset(request.nbid)) {
    query['Nbid'] = request.nbid;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.spnInstanceCode)) {
    body['SpnInstanceCode'] = request.spnInstanceCode;
  }
  if (!Util.isUnset(request.userDeductRulesShrink)) {
    body['UserDeductRules'] = request.userDeductRulesShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SetSavingPlanUserDeductRule',
    version = '2023-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 设置节省计划用户级抵扣规则
 *
 * @param request SetSavingPlanUserDeductRuleRequest
 * @return SetSavingPlanUserDeductRuleResponse
 */
async function setSavingPlanUserDeductRule(request: SetSavingPlanUserDeductRuleRequest): SetSavingPlanUserDeductRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return setSavingPlanUserDeductRuleWithOptions(request, runtime);
}

